package com.sg.service.biz.bff.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.exception.Assert;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.bff.req.*;
import com.sg.dto.biz.bff.res.*;
import com.sg.service.biz.bff.PowerService;
import com.sg.service.biz.bff.nb.NbPower;
import com.wicket.okrframework.integration.dto.*;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class PowerServiceImpl implements PowerService {
    @Resource
    NbPower nbPower;
    @Resource
    com.sg.service.biz.framework.PowerService fwBasePowerClient;
    @Resource
    com.sg.service.biz.framework.InductionRecordService fwBaseInductionRecordClient;
    @Resource
    private RedisUtil redisUtil;
    @Resource
    com.sg.service.biz.framework.DivineDataService fwBaseDivineDataClient;

    @Resource
    com.sg.service.biz.framework.RoleService fwBaseRoleClient;

    /**
     * B-检查权限（公共）[1705]
     * gen by moon at 8/10/2022, 3:37:12 AM
     */
    @Trace(operationName = "B-检查权限（公共）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffCheckPowerComRespDto checkPowerCom(BffCheckPowerComReqDto reqDto) {


        GetUserAllPowerRespDto getUserAllPowerRes_1 = null;
//步骤0: D1-获取用户全部权限 - getUserAllPower
        //ModelCode: getUserAllPower
        GetUserAllPowerRespDto getUserAllPowerRes = null;
        GetUserAllPowerReqDto getUserAllPowerReq = new GetUserAllPowerReqDto();
        getUserAllPowerReq.setOriginalRoleMemberId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecOriginalRoleMemberId());//CURRENT_ORIGINAL_ROLE_MEMBERID//sourceId:63291_1

        /*D1-获取用户全部权限[1707]  前端入参权限数据集，和用户信息中的权限数据集进行比对，返回用户有的权限集合 */
        Assert.isNull(getUserAllPowerReq.getOriginalRoleMemberId(), "B-检查权限（公共）-D1-获取用户全部权限-身份人员ID不能为空", false);
        getUserAllPowerRes = nbPower.getUserAllPower(getUserAllPowerReq);

        getUserAllPowerRes_1 = getUserAllPowerRes;

        BffCheckPowerComRespDto retData = new BffCheckPowerComRespDto();
        if (getUserAllPowerRes_1 != null) {
            retData.setPowerCodeList(getUserAllPowerRes_1.getPowerCodeList());//sourceId:51047_1
        }


        return retData;
    }

    /**
     * B1-2新增管理的部门（管理）[1213]
     * gen by moon at 8/22/2022, 10:22:53 PM
     */
    @Trace(operationName = "B1-2新增管理的部门（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffAddManageDeptRespDto addManageDept(BffAddManageDeptReqDto reqDto) {


        AddManageDeptRespDto addManageDeptRespDto_1 = null;
//步骤0: D1-2新增管理的部门 - addManageDept
        AddManageDeptRespDto addManageDeptRespDto = null;
        AddManageDeptReqDto addManageDeptReqDto = new AddManageDeptReqDto();
        if (reqDto != null) {
            addManageDeptReqDto.setOrganizationId(reqDto.getOrganizationId());//sourceId:31696_1
            addManageDeptReqDto.setDeptId(reqDto.getDeptId());//sourceId:31697_1
            addManageDeptReqDto.setRoleMemberId(reqDto.getRoleMemberId());//sourceId:31698_1
            addManageDeptReqDto.setOriginalRoleMemberId(reqDto.getOriginalRoleMemberId());//sourceId:31699_1
        }

        /*D1-2新增管理的部门[1129]   */
        Assert.isNull(addManageDeptReqDto.getOrganizationId(), "B1-2新增管理的部门（管理）-D1-2新增管理的部门-组织ID不能为空", false);
        Assert.isNull(addManageDeptReqDto.getDeptId(), "B1-2新增管理的部门（管理）-D1-2新增管理的部门-部门ID不能为空", false);
        Assert.isNull(addManageDeptReqDto.getRoleMemberId(), "B1-2新增管理的部门（管理）-D1-2新增管理的部门-角色人员ID不能为空", false);
        Assert.isNull(addManageDeptReqDto.getOriginalRoleMemberId(), "B1-2新增管理的部门（管理）-D1-2新增管理的部门-身份人员ID不能为空", false);
        addManageDeptRespDto = fwBasePowerClient.addManageDept(addManageDeptReqDto).getData();

        addManageDeptRespDto_1 = addManageDeptRespDto;

        BffAddManageDeptRespDto retData = new BffAddManageDeptRespDto();
        if (addManageDeptRespDto_1 != null) {
            retData.setManagedDepId(addManageDeptRespDto_1.getManagedDepId());//sourceId:31708_1
        }


        return retData;
    }

    /**
     * B1-2查询管理的部门列表（管理）[1211]
     * gen by moon at 8/10/2022, 3:33:43 AM
     */
    @Trace(operationName = "B1-2查询管理的部门列表（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryManageDeptListRespDto queryManageDeptList(BffQueryManageDeptListReqDto reqDto) {


        QueryManageDeptListBorderRespDto queryManageDeptListBorderRespDto_1 = null;
//步骤0: D1-2查管理的部门列表(边界) - queryManageDeptListBorder
        QueryManageDeptListBorderRespDto queryManageDeptListBorderRespDto = null;
        QueryManageDeptListBorderReqDto queryManageDeptListBorderReqDto = new QueryManageDeptListBorderReqDto();
        if (reqDto != null) {
            queryManageDeptListBorderReqDto.setRoleMemberId(reqDto.getRoleMemberId());//sourceId:28305_1
        }

        /*D1-2查管理的部门列表(边界)[1219]   */
        Assert.isNull(queryManageDeptListBorderReqDto.getRoleMemberId(), "B1-2查询管理的部门列表（管理）-D1-2查管理的部门列表(边界)-角色人员ID不能为空", false);
        queryManageDeptListBorderRespDto = fwBasePowerClient.queryManageDeptListBorder(queryManageDeptListBorderReqDto).getData();

        queryManageDeptListBorderRespDto_1 = queryManageDeptListBorderRespDto;

        BffQueryManageDeptListRespDto retData = new BffQueryManageDeptListRespDto();
        if (queryManageDeptListBorderRespDto_1 != null) {
            retData.setManagedDeptList(queryManageDeptListBorderRespDto_1.getManagedDeptList().stream().map(item -> BeanUtil.toBean(item, BffManagedDeptListDto.class)).collect(Collectors.toList()));//sourceId:28307_1
        }


        return retData;
    }

    /**
     * B1-2查询权限分配的角色列表（管理）[1103]
     * gen by moon at 8/10/2022, 3:32:38 AM
     */
    @Trace(operationName = "B1-2查询权限分配的角色列表（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTributPowerRoleListRespDto queryTributPowerRoleList(BffQueryTributPowerRoleListReqDto reqDto) {


        QueryTributPowerRoleListRespDto queryTributPowerRoleListRespDto_1 = null;
//步骤0: D1-2查询权限分配的角色列表 - queryTributPowerRoleList
        QueryTributPowerRoleListRespDto queryTributPowerRoleListRespDto = null;
        QueryTributPowerRoleListReqDto queryTributPowerRoleListReqDto = new QueryTributPowerRoleListReqDto();


        /*D1-2查询权限分配的角色列表[1601]   */

        queryTributPowerRoleListRespDto = fwBasePowerClient.queryTributPowerRoleList(queryTributPowerRoleListReqDto).getData();

        queryTributPowerRoleListRespDto_1 = queryTributPowerRoleListRespDto;

        BffQueryTributPowerRoleListRespDto retData = new BffQueryTributPowerRoleListRespDto();
        if (queryTributPowerRoleListRespDto_1 != null) {
            retData.setRoleList(queryTributPowerRoleListRespDto_1.getRoleList().stream().map(item -> BeanUtil.toBean(item, BffFrameworkSceneRoleDto.class)).collect(Collectors.toList()));//sourceId:46390_1
        }


        retData.setPageNum(queryTributPowerRoleListRespDto.getPageNum());
        retData.setPageSize(queryTributPowerRoleListRespDto.getPageSize());
        retData.setTotal(queryTributPowerRoleListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryTributPowerRoleListRespDto.getTotalNum()) / Double.valueOf(queryTributPowerRoleListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-2查询部门管理权限[1810]
     */
    @Trace(operationName = "B1-2查询部门管理权限")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryDeptPowerDetailRespDto queryDeptPowerDetail(BffQueryDeptPowerDetailReqDto reqDto) {


        QueryDeptPowerDetailBorderRespDto queryDeptPowerDetailBorderRespDto_1 = null;
//步骤0: D1-2查询部门管理权限详情(边界) - queryDeptPowerDetailBorder
        QueryDeptPowerDetailBorderRespDto queryDeptPowerDetailBorderRespDto = null;
        QueryDeptPowerDetailBorderReqDto queryDeptPowerDetailBorderReqDto = new QueryDeptPowerDetailBorderReqDto();


        /*D1-2查询部门管理权限详情(边界)[1806]   */
        queryDeptPowerDetailBorderRespDto = fwBasePowerClient.queryDeptPowerDetailBorder(queryDeptPowerDetailBorderReqDto).getData();

        queryDeptPowerDetailBorderRespDto_1 = queryDeptPowerDetailBorderRespDto;

        BffQueryDeptPowerDetailRespDto retData = new BffQueryDeptPowerDetailRespDto();
        if (queryDeptPowerDetailBorderRespDto_1 != null) {
            retData.setDeptId(queryDeptPowerDetailBorderRespDto_1.getDeptId());//sourceId:55515_1
            retData.setDeptCode(queryDeptPowerDetailBorderRespDto_1.getDeptCode());//sourceId:55516_1
            retData.setDeptName(queryDeptPowerDetailBorderRespDto_1.getDeptName());//sourceId:55517_1
        }


        return retData;
    }

    /**
     * B1-存档权限分配（管理）（公共）[1724]
     * gen by moon at 8/22/2022, 10:22:56 PM
     */
    @Trace(operationName = "B1-存档权限分配（管理）（公共）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffArchiveTributPowerComRespDto archiveTributPowerCom(BffArchiveTributPowerComReqDto reqDto) {


        //步骤0: 存档权限分配 - archiveTributPower
        ArchiveTributPowerRespDto archiveTributPowerRespDto = null;
        ArchiveTributPowerReqDto archiveTributPowerReqDto = new ArchiveTributPowerReqDto();
        if (reqDto != null) {
            archiveTributPowerReqDto.setPrivacyDistributionId(reqDto.getPrivacyDistributionId());//sourceId:51859_1
        }

        /*存档权限分配[1720]   */

        archiveTributPowerRespDto = fwBasePowerClient.archiveTributPower(archiveTributPowerReqDto).getData();


//步骤1: D1-2查询权限分配详情 - queryTributPowerDetail
        QueryTributPowerDetailRespDto queryTributPowerDetailRespDto = null;
        QueryTributPowerDetailReqDto queryTributPowerDetailReqDto = new QueryTributPowerDetailReqDto();
        if (reqDto != null) {
            queryTributPowerDetailReqDto.setPrivacyDistributionId(reqDto.getPrivacyDistributionId());//sourceId:52761_1
        }

        /*D1-2查询权限分配详情[1115]   */
        Assert.isNull(queryTributPowerDetailReqDto.getPrivacyDistributionId(), "B1-存档权限分配（管理）（公共）-D1-2查询权限分配详情-权限分配ID不能为空", false);
        queryTributPowerDetailRespDto = fwBasePowerClient.queryTributPowerDetail(queryTributPowerDetailReqDto).getData();


//步骤2: D1-存档权限分配缓存 - archiveTributPowerRedis
        ArchiveTributPowerRedisRespDto archiveTributPowerRedisRespDto = null;
        if (queryTributPowerDetailRespDto != null) {
            ArchiveTributPowerRedisReqDto archiveTributPowerRedisReqDto = new ArchiveTributPowerRedisReqDto();
            if (queryTributPowerDetailRespDto != null) {
                archiveTributPowerRedisReqDto.setPrivacyId(queryTributPowerDetailRespDto.getPrivacyId());//sourceId:52782_1
            }

            /*D1-存档权限分配缓存[1725]   */
            Assert.isNull(archiveTributPowerRedisReqDto.getPrivacyId(), "B1-存档权限分配（管理）（公共）-D1-存档权限分配缓存-权限ID不能为空", false);
            archiveTributPowerRedisRespDto = fwBasePowerClient.archiveTributPowerRedis(archiveTributPowerRedisReqDto).getData();


        }

        BffArchiveTributPowerComRespDto retData = new BffArchiveTributPowerComRespDto();


        return retData;
    }

    /**
     * B1-2存档部门权限分配（管理）[1613]
     * gen by moon at 10/15/2022, 5:53:24 PM
     */
    @Trace(operationName = "B1-2存档部门权限分配（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffArchiveTribuDeptPowerRespDto archiveTribuDeptPower(BffArchiveTribuDeptPowerReqDto reqDto) {


        //步骤0: D1-2存档部门权限分配 - archiveTribuDeptPower
        ArchiveTribuDeptPowerRespDto archiveTribuDeptPowerRespDto = null;
        ArchiveTribuDeptPowerReqDto archiveTribuDeptPowerReqDto = new ArchiveTribuDeptPowerReqDto();
        if (reqDto != null) {
            archiveTribuDeptPowerReqDto.setPrivacyDistributionId(reqDto.getPrivacyDistributionId());//SimpleFieldAssign//sourceId:379306_1
        }

        /*D1-2存档部门权限分配[1614]   */
        Assert.isNull(archiveTribuDeptPowerReqDto.getPrivacyDistributionId(), "B1-2存档部门权限分配（管理）-D1-2存档部门权限分配-权限分配ID不能为空", false);
        archiveTribuDeptPowerRespDto = fwBasePowerClient.archiveTribuDeptPower(archiveTribuDeptPowerReqDto).getData();


        BffArchiveTribuDeptPowerRespDto retData = new BffArchiveTribuDeptPowerRespDto();


        return retData;
    }

    /**
     * B1-2查询权限分配列表（管理边界）[1611]
     * gen by moon at 4/26/2023, 12:39:53 AM
     */
    @Trace(operationName = "B1-2查询权限分配列表（管理边界）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTributPowerListBorderRespDto queryTributPowerListBorder(BffQueryTributPowerListBorderReqDto reqDto) {


        QueryTributPowerListRespDto queryTributPowerListRespDto_1 = null;
        BatchQueryInductionRecordListComRespDto batchQueryInductionRecordListComRespDto_1 = null;
//步骤0: D1-2查询权限分配列表 - queryTributPowerList
        QueryTributPowerListRespDto queryTributPowerListRespDto = null;
        QueryTributPowerListReqDto queryTributPowerListReqDto = new QueryTributPowerListReqDto();
        queryTributPowerListReqDto.setTypeCode("DEPARTMENT");//sourceId:46622_1
        queryTributPowerListReqDto.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:46624_1
        if (reqDto != null) {
            queryTributPowerListReqDto.setAllocationObjectId(reqDto.getAllocationObjectId());//SimpleFieldAssign//sourceId:46623_1
        }

        /*D1-2查询权限分配列表[704]   */
        Assert.isNull(queryTributPowerListReqDto.getTypeCode(), "B1-2查询权限分配列表（管理边界）-D1-2查询权限分配列表-分配对象类型编码不能为空", false);
        Assert.isNull(queryTributPowerListReqDto.getAllocationObjectId(), "B1-2查询权限分配列表（管理边界）-D1-2查询权限分配列表-分配对象ID不能为空", false);
        Assert.isNull(queryTributPowerListReqDto.getSubjectLifeCycle(), "B1-2查询权限分配列表（管理边界）-D1-2查询权限分配列表-主体生命周期不能为空", false);
        queryTributPowerListRespDto = fwBasePowerClient.queryTributPowerList(queryTributPowerListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryTributPowerListRespDto_1 = queryTributPowerListRespDto;

//步骤1: D1-3批量查询就职记录列表（公共） - batchQueryInductionRecordListCom
        BatchQueryInductionRecordListComRespDto batchQueryInductionRecordListComRespDto = null;
        if (queryTributPowerListRespDto != null) {
            BatchQueryInductionRecordListComReqDto batchQueryInductionRecordListComReqDto = new BatchQueryInductionRecordListComReqDto();
            if (queryTributPowerListRespDto != null && queryTributPowerListRespDto.getTributPowerList() != null && !CollectionUtil.isEmpty(queryTributPowerListRespDto.getTributPowerList())) {
                batchQueryInductionRecordListComReqDto.setPerOrgInductionRecordList(queryTributPowerListRespDto.getTributPowerList().stream().map(item -> item.getOperationInductionId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:46627_1
            }

            /*D1-3批量查询就职记录列表（公共）[602]   */

            batchQueryInductionRecordListComRespDto = fwBaseInductionRecordClient.batchQueryInductionRecordListCom(batchQueryInductionRecordListComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            batchQueryInductionRecordListComRespDto_1 = batchQueryInductionRecordListComRespDto;
        }

        BffQueryTributPowerListBorderRespDto retData = new BffQueryTributPowerListBorderRespDto();
        //数据集融合  MoreListToOneSource
        if (queryTributPowerListRespDto_1 != null && !CollectionUtil.isEmpty(queryTributPowerListRespDto_1.getTributPowerList())) {
            for (TributPowerDto tributPowerDto : queryTributPowerListRespDto_1.getTributPowerList()) {
                BffTributPowerDto retElm = new BffTributPowerDto();
                if (queryTributPowerListRespDto_1 != null) {
                    retElm.setPrivacyDistributionId(tributPowerDto.getPrivacyDistributionId());//SimpleFieldAssign//sourceId:35038_2
                    retElm.setPrivacyId(tributPowerDto.getPrivacyId());//SimpleFieldAssign//sourceId:22991_2
                    retElm.setPrivacyCode(tributPowerDto.getPrivacyCode());//SimpleFieldAssign//sourceId:22994_2
                    retElm.setPrivacyName(tributPowerDto.getPrivacyName());//SimpleFieldAssign//sourceId:22996_2
                    retElm.setOperationInductionId(tributPowerDto.getOperationInductionId());//SimpleFieldAssign//sourceId:22997_2
                    retElm.setOperateTime(tributPowerDto.getOperateTime());//SimpleFieldAssign//sourceId:22998_2
                }
                retData.getTributPowerList().add(retElm);
                if (batchQueryInductionRecordListComRespDto_1 != null) {
                    for (PerOrgInductionRecordDto perOrgInductionRecordDto : batchQueryInductionRecordListComRespDto_1.getPerOrgInductionRecordList()) {
                        if (perOrgInductionRecordDto.getInductionRecordId().equals(tributPowerDto.getOperationInductionId())) {
                            if (batchQueryInductionRecordListComRespDto_1 != null) {
                                retElm.setUserId(perOrgInductionRecordDto.getUserId());//SimpleFieldAssign//sourceId:38898_2
                                retElm.setUserFace(perOrgInductionRecordDto.getUserFace());//SimpleFieldAssign//sourceId:38901_2
                                retElm.setIdCardName(perOrgInductionRecordDto.getIdCardName());//SimpleFieldAssign//sourceId:38899_2
                                retElm.setNickName(perOrgInductionRecordDto.getNickName());//SimpleFieldAssign//sourceId:38900_2
                            }
                        }
                    }
                }

            }
        }//sourceId:46657_1


        retData.setPageNum(queryTributPowerListRespDto.getPageNum());
        retData.setPageSize(queryTributPowerListRespDto.getPageSize());
        retData.setTotal(queryTributPowerListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryTributPowerListRespDto.getTotalNum()) / Double.valueOf(queryTributPowerListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-2查询分配的部门权限列表（管理）[1116]
     * gen by moon at 8/22/2022, 10:22:52 PM
     */
    @Trace(operationName = "B1-2查询分配的部门权限列表（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTribuDeptPowerListRespDto queryTribuDeptPowerList(BffQueryTribuDeptPowerListReqDto reqDto) {


        QueryTribuDeptPowerListRespDto queryTribuDeptPowerListRespDto_1 = null;
//步骤0: D1-2查询分配的部门权限列表 - queryTribuDeptPowerList
        QueryTribuDeptPowerListRespDto queryTribuDeptPowerListRespDto = null;
        QueryTribuDeptPowerListReqDto queryTribuDeptPowerListReqDto = new QueryTribuDeptPowerListReqDto();
        if (reqDto != null) {
            queryTribuDeptPowerListReqDto.setAllocationObjectId(reqDto.getAllocationObjectId());//sourceId:46799_1
        }

        /*D1-2查询分配的部门权限列表[1612]   */
        Assert.isNull(queryTribuDeptPowerListReqDto.getAllocationObjectId(), "B1-2查询分配的部门权限列表（管理）-D1-2查询分配的部门权限列表-分配对象ID不能为空", false);
        queryTribuDeptPowerListRespDto = fwBasePowerClient.queryTribuDeptPowerList(queryTribuDeptPowerListReqDto).getData();

        queryTribuDeptPowerListRespDto_1 = queryTribuDeptPowerListRespDto;

        BffQueryTribuDeptPowerListRespDto retData = new BffQueryTribuDeptPowerListRespDto();
        if (queryTribuDeptPowerListRespDto_1 != null) {
            retData.setFrameworkPrivacyList(queryTribuDeptPowerListRespDto_1.getFrameworkPrivacyList().stream().map(item -> BeanUtil.toBean(item, BffFrameworkPrivacyDto.class)).collect(Collectors.toList()));//sourceId:46819_1
        }


        return retData;
    }

    /**
     * B1-2查询权限分配详情(管理)[1114]
     * gen by moon at 8/10/2022, 3:32:51 AM
     */
    @Trace(operationName = "B1-2查询权限分配详情(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTributPowerDetailRespDto queryTributPowerDetail(BffQueryTributPowerDetailReqDto reqDto) {


        QueryTributPowerDetailRespDto queryTributPowerDetailRespDto_1 = null;
//步骤0: D1-2查询权限分配详情 - queryTributPowerDetail
        QueryTributPowerDetailRespDto queryTributPowerDetailRespDto = null;
        QueryTributPowerDetailReqDto queryTributPowerDetailReqDto = new QueryTributPowerDetailReqDto();
        if (reqDto != null) {
            queryTributPowerDetailReqDto.setPrivacyDistributionId(reqDto.getPrivacyDistributionId());//sourceId:46825_1
        }

        /*D1-2查询权限分配详情[1115]   */
        Assert.isNull(queryTributPowerDetailReqDto.getPrivacyDistributionId(), "B1-2查询权限分配详情(管理)-D1-2查询权限分配详情-权限分配ID不能为空", false);
        queryTributPowerDetailRespDto = fwBasePowerClient.queryTributPowerDetail(queryTributPowerDetailReqDto).getData();

        queryTributPowerDetailRespDto_1 = queryTributPowerDetailRespDto;

        BffQueryTributPowerDetailRespDto retData = new BffQueryTributPowerDetailRespDto();
        if (queryTributPowerDetailRespDto_1 != null) {
            retData.setPrivacyDistributionId(queryTributPowerDetailRespDto_1.getPrivacyDistributionId());//sourceId:46841_1
            retData.setPrivacyId(queryTributPowerDetailRespDto_1.getPrivacyId());//sourceId:46842_1
            retData.setPrivacyCode(queryTributPowerDetailRespDto_1.getPrivacyCode());//sourceId:46843_1
            retData.setPrivacyName(queryTributPowerDetailRespDto_1.getPrivacyName());//sourceId:46844_1
            retData.setPrivacyIntroduce(queryTributPowerDetailRespDto_1.getPrivacyIntroduce());//sourceId:46845_1
            retData.setPrivacyLogo(queryTributPowerDetailRespDto_1.getPrivacyLogo());//sourceId:46846_1
            retData.setStrategyType(queryTributPowerDetailRespDto_1.getStrategyType());//sourceId:46847_1
            retData.setOperationInductionId(queryTributPowerDetailRespDto_1.getOperationInductionId());//sourceId:46848_1
            retData.setOriginalRoleMemberId(queryTributPowerDetailRespDto_1.getOriginalRoleMemberId());//sourceId:46849_1
            retData.setUserId(queryTributPowerDetailRespDto_1.getUserId());//sourceId:46850_1
            retData.setUserFace(queryTributPowerDetailRespDto_1.getUserFace());//sourceId:46851_1
            retData.setIdCardName(queryTributPowerDetailRespDto_1.getIdCardName());//sourceId:46852_1
            retData.setNickName(queryTributPowerDetailRespDto_1.getNickName());//sourceId:46853_1
            retData.setOperateTime(queryTributPowerDetailRespDto_1.getOperateTime());//sourceId:46854_1
        }


        return retData;
    }

    /**
     * B1-2查询权限分配的部门职务列表（管理）[1106]
     * gen by moon at 8/10/2022, 3:32:47 AM
     */
    @Trace(operationName = "B1-2查询权限分配的部门职务列表（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTributPowerDeptPositionListRespDto queryTributPowerDeptPositionList(BffQueryTributPowerDeptPositionListReqDto reqDto) {


        QueryTributPowerDeptPositionListRespDto queryTributPowerDeptPositionListRespDto_1 = null;
//步骤0: D1-2查询权限分配的部门职务列表 - queryTributPowerDeptPositionList
        QueryTributPowerDeptPositionListRespDto queryTributPowerDeptPositionListRespDto = null;
        QueryTributPowerDeptPositionListReqDto queryTributPowerDeptPositionListReqDto = new QueryTributPowerDeptPositionListReqDto();
        if (reqDto != null) {
            queryTributPowerDeptPositionListReqDto.setOrgEntityId(reqDto.getOrgEntityId());//sourceId:46536_1
        }

        /*D1-2查询权限分配的部门职务列表[1608]   */
        Assert.isNull(queryTributPowerDeptPositionListReqDto.getOrgEntityId(), "B1-2查询权限分配的部门职务列表（管理）-D1-2查询权限分配的部门职务列表-所属对象实例ID不能为空", false);
        queryTributPowerDeptPositionListRespDto = fwBasePowerClient.queryTributPowerDeptPositionList(queryTributPowerDeptPositionListReqDto).getData();

        queryTributPowerDeptPositionListRespDto_1 = queryTributPowerDeptPositionListRespDto;

        BffQueryTributPowerDeptPositionListRespDto retData = new BffQueryTributPowerDeptPositionListRespDto();
        if (queryTributPowerDeptPositionListRespDto_1 != null) {
            retData.setPositionList(queryTributPowerDeptPositionListRespDto_1.getPositionList().stream().map(item -> BeanUtil.toBean(item, BffPositionDto.class)).collect(Collectors.toList()));//sourceId:46538_1
        }


        retData.setPageNum(queryTributPowerDeptPositionListRespDto.getPageNum());
        retData.setPageSize(queryTributPowerDeptPositionListRespDto.getPageSize());
        retData.setTotal(queryTributPowerDeptPositionListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryTributPowerDeptPositionListRespDto.getTotalNum()) / Double.valueOf(queryTributPowerDeptPositionListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-2查询权限分配的部门成员列表（管理）[1105]
     * gen by moon at 8/22/2022, 10:22:51 PM
     */
    @Trace(operationName = "B1-2查询权限分配的部门成员列表（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTributPowerInductionRecordListRespDto queryTributPowerInductionRecordList(BffQueryTributPowerInductionRecordListReqDto reqDto) {


        QueryTributPowerInductionRecordListRespDto queryTributPowerInductionRecordListRespDto_1 = null;
//步骤0: D1-2查询权限分配的成员列表 - queryTributPowerInductionRecordList
        QueryTributPowerInductionRecordListRespDto queryTributPowerInductionRecordListRespDto = null;
        QueryTributPowerInductionRecordListReqDto queryTributPowerInductionRecordListReqDto = new QueryTributPowerInductionRecordListReqDto();
        if (reqDto != null) {
            queryTributPowerInductionRecordListReqDto.setEntityId(reqDto.getEntityId());//sourceId:46488_1
        }

        /*D1-2查询权限分配的成员列表[1603]   */
        Assert.isNull(queryTributPowerInductionRecordListReqDto.getEntityId(), "B1-2查询权限分配的部门成员列表（管理）-D1-2查询权限分配的成员列表-就职单位对象实例ID不能为空", false);
        queryTributPowerInductionRecordListRespDto = fwBasePowerClient.queryTributPowerInductionRecordList(queryTributPowerInductionRecordListReqDto).getData();

        queryTributPowerInductionRecordListRespDto_1 = queryTributPowerInductionRecordListRespDto;

        BffQueryTributPowerInductionRecordListRespDto retData = new BffQueryTributPowerInductionRecordListRespDto();
        if (queryTributPowerInductionRecordListRespDto_1 != null) {
            retData.setPerOrgInductionRecordList(queryTributPowerInductionRecordListRespDto_1.getPerOrgInductionRecordList().stream().map(item -> BeanUtil.toBean(item, BffPerOrgInductionRecordDto.class)).collect(Collectors.toList()));//sourceId:63319_1
        }


        retData.setPageNum(queryTributPowerInductionRecordListRespDto.getPageNum());
        retData.setPageSize(queryTributPowerInductionRecordListRespDto.getPageSize());
        retData.setTotal(queryTributPowerInductionRecordListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryTributPowerInductionRecordListRespDto.getTotalNum()) / Double.valueOf(queryTributPowerInductionRecordListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-2查询权限分配的员工列表（管理）[1102]
     * gen by moon at 10/23/2022, 12:09:10 AM
     */
    @Trace(operationName = "B1-2查询权限分配的员工列表（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTributPowerMemberListRespDto queryTributPowerMemberList(BffQueryTributPowerMemberListReqDto reqDto) {


        QueryTributPowerMemberListRespDto queryTributPowerMemberListRespDto_1 = null;
//步骤0: D1-2查询权限分配的员工列表 - queryTributPowerMemberList
        QueryTributPowerMemberListRespDto queryTributPowerMemberListRespDto = null;
        QueryTributPowerMemberListReqDto queryTributPowerMemberListReqDto = new QueryTributPowerMemberListReqDto();
        if (reqDto != null) {
            queryTributPowerMemberListReqDto.setOrganizationId(reqDto.getOrganizationId());//SimpleFieldAssign//sourceId:46207_1
        }

        /*D1-2查询权限分配的员工列表[1595]   */
        Assert.isNull(queryTributPowerMemberListReqDto.getOrganizationId(), "B1-2查询权限分配的员工列表（管理）-D1-2查询权限分配的员工列表-组织ID不能为空", false);
        queryTributPowerMemberListRespDto = fwBasePowerClient.queryTributPowerMemberList(queryTributPowerMemberListReqDto).getData();


        queryTributPowerMemberListRespDto_1 = queryTributPowerMemberListRespDto;

        BffQueryTributPowerMemberListRespDto retData = new BffQueryTributPowerMemberListRespDto();
        if (queryTributPowerMemberListRespDto_1 != null) {
            retData.setBeginMemberList(queryTributPowerMemberListRespDto_1.getBeginMemberList().stream().map(item -> BeanUtil.toBean(item, BffBeginMemberDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:63311_1
        }


        retData.setPageNum(queryTributPowerMemberListRespDto.getPageNum());
        retData.setPageSize(queryTributPowerMemberListRespDto.getPageSize());
        retData.setTotal(queryTributPowerMemberListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryTributPowerMemberListRespDto.getTotalNum()) / Double.valueOf(queryTributPowerMemberListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-2查询权限分配的职务列表（管理）[1100]
     * gen by moon at 10/23/2022, 12:09:08 AM
     */
    @Trace(operationName = "B1-2查询权限分配的职务列表（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTributPowerPositionListRespDto queryTributPowerPositionList(BffQueryTributPowerPositionListReqDto reqDto) {


        QueryTributPowerPositionListRespDto queryTributPowerPositionListRespDto_1 = null;
//步骤0: D1-2查询权限分配的职务列表 - queryTributPowerPositionList
        QueryTributPowerPositionListRespDto queryTributPowerPositionListRespDto = null;
        QueryTributPowerPositionListReqDto queryTributPowerPositionListReqDto = new QueryTributPowerPositionListReqDto();
        if (reqDto != null) {
            queryTributPowerPositionListReqDto.setOrganizationId(reqDto.getOrganizationId());//SimpleFieldAssign//sourceId:46336_1
        }

        /*D1-2查询权限分配的职务列表[1599]   */
        Assert.isNull(queryTributPowerPositionListReqDto.getOrganizationId(), "B1-2查询权限分配的职务列表（管理）-D1-2查询权限分配的职务列表-组织ID不能为空", false);
        queryTributPowerPositionListRespDto = fwBasePowerClient.queryTributPowerPositionList(queryTributPowerPositionListReqDto).getData();


        queryTributPowerPositionListRespDto_1 = queryTributPowerPositionListRespDto;

        BffQueryTributPowerPositionListRespDto retData = new BffQueryTributPowerPositionListRespDto();
        if (queryTributPowerPositionListRespDto_1 != null) {
            retData.setPositionList(queryTributPowerPositionListRespDto_1.getPositionList().stream().map(item -> BeanUtil.toBean(item, BffPositionDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:46338_1
        }


        retData.setPageNum(queryTributPowerPositionListRespDto.getPageNum());
        retData.setPageSize(queryTributPowerPositionListRespDto.getPageSize());
        retData.setTotal(queryTributPowerPositionListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryTributPowerPositionListRespDto.getTotalNum()) / Double.valueOf(queryTributPowerPositionListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-2查询权限分配列表（管理）[1073]
     * gen by moon at 8/24/2022, 9:19:09 PM
     */
    @Trace(operationName = "B1-2查询权限分配列表（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTributPowerListRespDto queryTributPowerList(BffQueryTributPowerListReqDto reqDto) {


        QueryTributPowerListRespDto queryTributPowerListRespDto_1 = null;
        BatchQueryInductionRecordListComRespDto batchQueryInductionRecordListComRespDto_1 = null;
//步骤0: D1-2查询权限分配列表 - queryTributPowerList
        QueryTributPowerListRespDto queryTributPowerListRespDto = null;
        QueryTributPowerListReqDto queryTributPowerListReqDto = new QueryTributPowerListReqDto();
        if (reqDto != null) {
            queryTributPowerListReqDto.setTypeCode(reqDto.getTypeCode());//sourceId:44794_1
            queryTributPowerListReqDto.setAllocationObjectId(reqDto.getAllocationObjectId());//sourceId:44795_1
            queryTributPowerListReqDto.setIsArchive(reqDto.getIsArchive());//sourceId:44797_1
        }

        /*D1-2查询权限分配列表[704]   */

        queryTributPowerListRespDto = fwBasePowerClient.queryTributPowerList(queryTributPowerListReqDto).getData();

        queryTributPowerListRespDto_1 = queryTributPowerListRespDto;

//步骤1: D1-3批量查询就职记录列表（公共） - batchQueryInductionRecordListCom
        BatchQueryInductionRecordListComRespDto batchQueryInductionRecordListComRespDto = null;
        if (queryTributPowerListRespDto != null) {
            BatchQueryInductionRecordListComReqDto batchQueryInductionRecordListComReqDto = new BatchQueryInductionRecordListComReqDto();
            if (queryTributPowerListRespDto != null) {
                batchQueryInductionRecordListComReqDto.setPerOrgInductionRecordList(queryTributPowerListRespDto.getTributPowerList().stream().map(item -> item.getOperationInductionId())
                        .collect(Collectors.toList()));//sourceId:44803_1
            }

            /*D1-3批量查询就职记录列表（公共）[602]   */

            batchQueryInductionRecordListComRespDto = fwBaseInductionRecordClient.batchQueryInductionRecordListCom(batchQueryInductionRecordListComReqDto).getData();

            batchQueryInductionRecordListComRespDto_1 = batchQueryInductionRecordListComRespDto;
        }

        BffQueryTributPowerListRespDto retData = new BffQueryTributPowerListRespDto();
        //数据集融合
        if (queryTributPowerListRespDto_1 != null && !CollectionUtil.isEmpty(queryTributPowerListRespDto_1.getTributPowerList())) {
            for (TributPowerDto tributPowerDto : queryTributPowerListRespDto_1.getTributPowerList()) {
                BffTributPowerDto retElm = new BffTributPowerDto();
                if (queryTributPowerListRespDto_1 != null) {
                    retElm.setPrivacyDistributionId(tributPowerDto.getPrivacyDistributionId());//sourceId:21119_2
                    retElm.setPrivacyId(tributPowerDto.getPrivacyId());//sourceId:21120_2
                    retElm.setPrivacyLogo(tributPowerDto.getPrivacyLogo());//sourceId:21121_2
                    retElm.setPrivacyCode(tributPowerDto.getPrivacyCode());//sourceId:21122_2
                    retElm.setPrivacyName(tributPowerDto.getPrivacyName());//sourceId:21123_2
                    retElm.setTypeCode(tributPowerDto.getTypeCode());//sourceId:21124_2
                    retElm.setAllocationObjectId(tributPowerDto.getAllocationObjectId());//sourceId:21125_2
                    retElm.setSubjectLifeCycle(tributPowerDto.getSubjectLifeCycle());//sourceId:21126_2
                    retElm.setIsArchive(tributPowerDto.getIsArchive());//sourceId:21127_2
                    retElm.setOperationInductionId(tributPowerDto.getOperationInductionId());//sourceId:21128_2
                    retElm.setOperateTime(tributPowerDto.getOperateTime());//sourceId:21129_2
                }
                retData.getTributPowerList().add(retElm);
                if (batchQueryInductionRecordListComRespDto_1 != null) {
                    for (PerOrgInductionRecordDto perOrgInductionRecordDto : batchQueryInductionRecordListComRespDto_1.getPerOrgInductionRecordList()) {
                        if (perOrgInductionRecordDto.getInductionRecordId().equals(tributPowerDto.getOperationInductionId())) {
                            if (batchQueryInductionRecordListComRespDto_1 != null) {
                                retElm.setIdCardName(perOrgInductionRecordDto.getIdCardName());//sourceId:38880_2
                                retElm.setNickName(perOrgInductionRecordDto.getNickName());//sourceId:38881_2
                            }
                        }
                    }
                }

            }
        }//sourceId:44799_1


        retData.setPageNum(queryTributPowerListRespDto.getPageNum());
        retData.setPageSize(queryTributPowerListRespDto.getPageSize());
        retData.setTotal(queryTributPowerListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryTributPowerListRespDto.getTotalNum()) / Double.valueOf(queryTributPowerListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-2新增权限分配（管理）[1065]
     * gen by moon at 5/25/2023, 3:11:05 PM
     */
    @Trace(operationName = "B1-2新增权限分配（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffAddTributPowerRespDto addTributPower(BffAddTributPowerReqDto reqDto) {


        AddTributPowerRespDto addTributPowerRespDto_1 = null;
//步骤0: D1-2新增权限分配 - addTributPower
        AddTributPowerRespDto addTributPowerRespDto = null;
        AddTributPowerReqDto addTributPowerReqDto = new AddTributPowerReqDto();
        if (reqDto != null) {
            addTributPowerReqDto.setPrivacyId(reqDto.getPrivacyId());//SimpleFieldAssign//sourceId:45452_1
            addTributPowerReqDto.setTypeCode(reqDto.getTypeCode());//SimpleFieldAssign//sourceId:45454_1
            addTributPowerReqDto.setAllocationObjectId(reqDto.getAllocationObjectId());//SimpleFieldAssign//sourceId:45455_1
            addTributPowerReqDto.setBusinessPurposes(reqDto.getBusinessPurposes());//SimpleFieldAssign//sourceId:902045_1
            addTributPowerReqDto.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:45456_1
        }

        /*D1-2新增权限分配[1067]   */
        Assert.isNull(addTributPowerReqDto.getPrivacyId(), "B1-2新增权限分配（管理）-D1-2新增权限分配-权限ID不能为空", false);
        Assert.isNull(addTributPowerReqDto.getTypeCode(), "B1-2新增权限分配（管理）-D1-2新增权限分配-分配对象类型编码不能为空", false);
        Assert.isNull(addTributPowerReqDto.getAllocationObjectId(), "B1-2新增权限分配（管理）-D1-2新增权限分配-分配对象ID不能为空", false);
        Assert.isNull(addTributPowerReqDto.getSubjectLifeCycle(), "B1-2新增权限分配（管理）-D1-2新增权限分配-主体生命周期不能为空", false);
        addTributPowerRespDto = fwBasePowerClient.addTributPower(addTributPowerReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        addTributPowerRespDto_1 = addTributPowerRespDto;

        BffAddTributPowerRespDto retData = new BffAddTributPowerRespDto();
        if (addTributPowerRespDto_1 != null) {
            retData.setPrivacyDistributionId(addTributPowerRespDto_1.getPrivacyDistributionId());//SimpleFieldAssign//sourceId:45463_1
        }


        return retData;
    }

    /**
     * B1-2查询权限分配的部门列表（管理）[1061]
     * gen by moon at 10/23/2022, 12:09:05 AM
     */
    @Trace(operationName = "B1-2查询权限分配的部门列表（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryDeptTributPowerListRespDto queryDeptTributPowerList(BffQueryDeptTributPowerListReqDto reqDto) {


        QueryTributPowerDeptListRespDto queryTributPowerDeptListRespDto_1 = null;
//步骤0: D1-2查询权限分配的部门列表 - queryTributPowerDeptList
        QueryTributPowerDeptListRespDto queryTributPowerDeptListRespDto = null;
        QueryTributPowerDeptListReqDto queryTributPowerDeptListReqDto = new QueryTributPowerDeptListReqDto();
        if (reqDto != null) {
            queryTributPowerDeptListReqDto.setOrganizationId(reqDto.getOrganizationId());//SimpleFieldAssign//sourceId:45857_1
        }

        /*D1-2查询权限分配的部门列表[1581]   */
        Assert.isNull(queryTributPowerDeptListReqDto.getOrganizationId(), "B1-2查询权限分配的部门列表（管理）-D1-2查询权限分配的部门列表-组织ID不能为空", false);
        queryTributPowerDeptListRespDto = fwBasePowerClient.queryTributPowerDeptList(queryTributPowerDeptListReqDto).getData();


        queryTributPowerDeptListRespDto_1 = queryTributPowerDeptListRespDto;

        BffQueryDeptTributPowerListRespDto retData = new BffQueryDeptTributPowerListRespDto();
        if (queryTributPowerDeptListRespDto_1 != null) {
            retData.setDeptList(queryTributPowerDeptListRespDto_1.getDeptList().stream().map(item -> BeanUtil.toBean(item, BffDeptDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:63302_1
        }


        retData.setPageNum(queryTributPowerDeptListRespDto.getPageNum());
        retData.setPageSize(queryTributPowerDeptListRespDto.getPageSize());
        retData.setTotal(queryTributPowerDeptListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryTributPowerDeptListRespDto.getTotalNum()) / Double.valueOf(queryTributPowerDeptListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-2查询权限详情（管理）[1060]
     * gen by moon at 8/10/2022, 3:32:11 AM
     */
    @Trace(operationName = "B1-2查询权限详情（管理）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryPowerDetailRespDto queryPowerDetail(BffQueryPowerDetailReqDto reqDto) {


        QueryPowerDetailRespDto queryPowerDetailRespDto_1 = null;
//步骤0: D1-2查询权限详情 - queryPowerDetail
        QueryPowerDetailRespDto queryPowerDetailRespDto = null;
        QueryPowerDetailReqDto queryPowerDetailReqDto = new QueryPowerDetailReqDto();
        queryPowerDetailReqDto.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:44323_1
        if (reqDto != null) {
            queryPowerDetailReqDto.setPrivacyId(reqDto.getPrivacyId());//sourceId:26116_1
        }

        /*D1-2查询权限详情[559]   */
        Assert.isNull(queryPowerDetailReqDto.getPrivacyId(), "B1-2查询权限详情（管理）-D1-2查询权限详情-权限ID不能为空", false);
        Assert.isNull(queryPowerDetailReqDto.getSubjectLifeCycle(), "B1-2查询权限详情（管理）-D1-2查询权限详情-主体生命周期不能为空", false);
        queryPowerDetailRespDto = fwBasePowerClient.queryPowerDetail(queryPowerDetailReqDto).getData();

        queryPowerDetailRespDto_1 = queryPowerDetailRespDto;

        BffQueryPowerDetailRespDto retData = new BffQueryPowerDetailRespDto();
        if (queryPowerDetailRespDto_1 != null) {
            retData.setPrivacyId(queryPowerDetailRespDto_1.getPrivacyId());//sourceId:26137_1
            retData.setPrivacyLogo(queryPowerDetailRespDto_1.getPrivacyLogo());//sourceId:26142_1
            retData.setPrivacyName(queryPowerDetailRespDto_1.getPrivacyName());//sourceId:26139_1
            retData.setPrivacyCode(queryPowerDetailRespDto_1.getPrivacyCode());//sourceId:26138_1
            retData.setStrategyType(queryPowerDetailRespDto_1.getStrategyType());//sourceId:26146_1
            retData.setPrivacyIntroduce(queryPowerDetailRespDto_1.getPrivacyIntroduce());//sourceId:26140_1
        }


        return retData;
    }

    /**
     * B1-2-14删除管理的部门(管理)[4571]
     * gen by moon at 9/16/2022, 5:19:38 AM
     */
    @Trace(operationName = "B1-2-14删除管理的部门(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffDeleteManageDeptRespDto deleteManageDept(BffDeleteManageDeptReqDto reqDto) {


        //步骤0: D1-2-14删除管理的部门 - deleteManageDept
        DeleteManageDeptRespDto deleteManageDeptRespDto = null;
        DeleteManageDeptReqDto deleteManageDeptReqDto = new DeleteManageDeptReqDto();
        if (reqDto != null) {
            deleteManageDeptReqDto.setManagedDepId(reqDto.getManagedDepId());//sourceId:330018_1
        }

        /*D1-2-14删除管理的部门[4570]   */
        Assert.isNull(deleteManageDeptReqDto.getManagedDepId(), "B1-2-14删除管理的部门(管理)-D1-2-14删除管理的部门-管理的部门ID不能为空", false);
        deleteManageDeptRespDto = fwBasePowerClient.deleteManageDept(deleteManageDeptReqDto).getData();


        BffDeleteManageDeptRespDto retData = new BffDeleteManageDeptRespDto();


        return retData;
    }

    /**
     * B1-2判断权限分配可用[4573]
     * gen by moon at 5/21/2024, 2:47:21 AM
     */
    @Trace(operationName = "B1-2判断权限分配可用")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffJudgeTributPowerUsableRespDto judgeTributPowerUsable(BffJudgeTributPowerUsableReqDto reqDto) {


        ImplementReceiveFieldComRespDto implementReceiveFieldComRespDto_1 = null;
        ImplementReceiveFieldComRespDto implementReceiveFieldComRespDto_3 = null;
//virtualUsage D1执行接收字段(默认赋值0)  16423
        ImplementReceiveFieldComRespDto implementReceiveFieldComRespDto = null;
        ImplementReceiveFieldComReqDto implementReceiveFieldComReqDto = new ImplementReceiveFieldComReqDto();
        implementReceiveFieldComReqDto.setOutputNum(Long.valueOf(0));//CUSTOM_CONVENTION//sourceId:332295_1_16423

        /*D1执行接收字段(默认赋值0)[4237]   */
        Assert.isNull(implementReceiveFieldComReqDto.getOutputNum(), "B1-2判断权限分配可用-D1执行接收字段(默认赋值0)-传输数值（整数型）不能为空", false);
        implementReceiveFieldComRespDto = fwBaseDivineDataClient.implementReceiveFieldCom(implementReceiveFieldComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        implementReceiveFieldComRespDto_1 = implementReceiveFieldComRespDto;
//virtualUsage D1查询用于权限角色列表(公共)  16424
        QueryRoleOfPowerListComRespDto queryRoleOfPowerListComRespDto = null;
        QueryRoleOfPowerListComReqDto queryRoleOfPowerListComReqDto = new QueryRoleOfPowerListComReqDto();
        queryRoleOfPowerListComReqDto.setOriginalRoleMemberId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecOriginalRoleMemberId());//CURRENT_ORIGINAL_ROLE_MEMBERID//sourceId:332293_1_16424
        queryRoleOfPowerListComReqDto.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:1811485_1_16424

        /*D1查询用于权限角色列表(公共)[2189]   */
        Assert.isNull(queryRoleOfPowerListComReqDto.getOriginalRoleMemberId(), "B1-2判断权限分配可用-D1查询用于权限角色列表(公共)-身份人员ID不能为空", false);
        Assert.isNull(queryRoleOfPowerListComReqDto.getSubjectLifeCycle(), "B1-2判断权限分配可用-D1查询用于权限角色列表(公共)-主体生命周期不能为空", false);
        queryRoleOfPowerListComRespDto = fwBaseRoleClient.queryRoleOfPowerListCom(queryRoleOfPowerListComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


//virtualUsage D1-2批量查询权限分配by分配对象(公共)  16425
        BatchQueryTributPowerComByObjRespDto batchQueryTributPowerComByObjRespDto = null;
        if (queryRoleOfPowerListComRespDto != null) {
            BatchQueryTributPowerComByObjReqDto batchQueryTributPowerComByObjReqDto = new BatchQueryTributPowerComByObjReqDto();
            batchQueryTributPowerComByObjReqDto.setTypeCode("ROLE");//sourceId:332278_1_16425
            batchQueryTributPowerComByObjReqDto.setPrivacyCode("POWER_DISTRIBUTION_MGT_POWER");//CUSTOM_CONVENTION//sourceId:332271_1_16425
            if (queryRoleOfPowerListComRespDto != null && queryRoleOfPowerListComRespDto.getRoleRelList() != null && !CollectionUtil.isEmpty(queryRoleOfPowerListComRespDto.getRoleRelList())) {
                batchQueryTributPowerComByObjReqDto.setTributPowerList(queryRoleOfPowerListComRespDto.getRoleRelList().stream().map(item -> item.getRoleId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:332270_1_16425
            }

            /*D1-2批量查询权限分配by分配对象(公共)[4575]   */
            Assert.isNull(batchQueryTributPowerComByObjReqDto.getTypeCode(), "B1-2判断权限分配可用-D1-2批量查询权限分配by分配对象(公共)-分配对象类型编码不能为空", false);
            Assert.isNull(batchQueryTributPowerComByObjReqDto.getPrivacyCode(), "B1-2判断权限分配可用-D1-2批量查询权限分配by分配对象(公共)-权限标识不能为空", false);
            batchQueryTributPowerComByObjRespDto = fwBasePowerClient.batchQueryTributPowerComByObj(batchQueryTributPowerComByObjReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        }
        if ((batchQueryTributPowerComByObjRespDto != null && batchQueryTributPowerComByObjRespDto.getTributPowerList() != null && batchQueryTributPowerComByObjRespDto.getTributPowerList().size() > 0 && batchQueryTributPowerComByObjRespDto != null && batchQueryTributPowerComByObjRespDto.getTributPowerList() != null && batchQueryTributPowerComByObjRespDto.getTributPowerList().size() > 0)) {
            //if(D1-2批量查询权限分配by分配对象(公共).权限分配列表数据集条数 大于 0)  16426

            ImplementReceiveFieldComRespDto implementReceiveFieldComRespDto_2 = null;
            ImplementReceiveFieldComReqDto implementReceiveFieldComReqDto_1 = new ImplementReceiveFieldComReqDto();
            implementReceiveFieldComReqDto_1.setOutputNum(Long.valueOf(1));//CUSTOM_CONVENTION//sourceId:332302_1_16427

            /*D1执行接收字段(默认赋值1)[4237]   */
            Assert.isNull(implementReceiveFieldComReqDto_1.getOutputNum(), "B1-2判断权限分配可用-D1执行接收字段(默认赋值1)-传输数值（整数型）不能为空", false);
            implementReceiveFieldComRespDto_2 = fwBaseDivineDataClient.implementReceiveFieldCom(implementReceiveFieldComReqDto_1).getData()/*vcase invoke 跨dubbo调用;*/;


            implementReceiveFieldComRespDto_3 = implementReceiveFieldComRespDto_2;
//processBranchName:正常结束 ,processBranchId:16428

        } else {
            //else  16429

//processBranchName:正常结束 ,processBranchId:16430

        }
        BffJudgeTributPowerUsableRespDto retData = new BffJudgeTributPowerUsableRespDto();
        if (implementReceiveFieldComRespDto_1 != null) {
            retData.setOutputNum(implementReceiveFieldComRespDto_1.getOutputNum());//SimpleFieldAssign//sourceId:332305_1
        }
        if (implementReceiveFieldComRespDto_3 != null) {
            retData.setOutputNum(implementReceiveFieldComRespDto_3.getOutputNum());//SimpleFieldAssign//sourceId:332305_1
        }


        return retData;
    }

    /**
     * B1查询一级部门下分配权限人员列表(管理)[5140]
     * gen by moon at 11/7/2022, 7:36:11 PM
     */
    @Trace(operationName = "B1查询一级部门下分配权限人员列表(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryOneDeptTributPowerStaffListRespDto queryOneDeptTributPowerStaffList(BffQueryOneDeptTributPowerStaffListReqDto reqDto) {


        QueryOneDeptTributPowerStaffListRespDto queryOneDeptTributPowerStaffListRespDto_1 = null;
//步骤0: D1查询一级部门下分配权限人员列表(管理) - queryOneDeptTributPowerStaffList
        QueryOneDeptTributPowerStaffListRespDto queryOneDeptTributPowerStaffListRespDto = null;
        QueryOneDeptTributPowerStaffListReqDto queryOneDeptTributPowerStaffListReqDto = new QueryOneDeptTributPowerStaffListReqDto();
        if (reqDto != null) {
            queryOneDeptTributPowerStaffListReqDto.setDeptCode(reqDto.getDeptCode());//SimpleFieldAssign//sourceId:422801_1
        }

        /*D1查询一级部门下分配权限人员列表(管理)[5136]   */
        Assert.isNull(queryOneDeptTributPowerStaffListReqDto.getDeptCode(), "B1查询一级部门下分配权限人员列表(管理)-D1查询一级部门下分配权限人员列表(管理)-部门标识不能为空", false);
        queryOneDeptTributPowerStaffListRespDto = fwBasePowerClient.queryOneDeptTributPowerStaffList(queryOneDeptTributPowerStaffListReqDto).getData();


        queryOneDeptTributPowerStaffListRespDto_1 = queryOneDeptTributPowerStaffListRespDto;

        BffQueryOneDeptTributPowerStaffListRespDto retData = new BffQueryOneDeptTributPowerStaffListRespDto();
        if (queryOneDeptTributPowerStaffListRespDto_1 != null) {
            retData.setOneDeptTributPowerStaffList(queryOneDeptTributPowerStaffListRespDto_1.getOneDeptTributPowerStaffList().stream().map(item -> BeanUtil.toBean(item, BffOneDeptTributPowerStaffDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:422805_1
        }


        retData.setPageNum(queryOneDeptTributPowerStaffListRespDto.getPageNum());
        retData.setPageSize(queryOneDeptTributPowerStaffListRespDto.getPageSize());
        retData.setTotal(queryOneDeptTributPowerStaffListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryOneDeptTributPowerStaffListRespDto.getTotalNum()) / Double.valueOf(queryOneDeptTributPowerStaffListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B1-2查询当前用户权限列表（角色+部门个人）[5713]
     * gen by moon at 8/31/2024, 1:11:33 PM
     */
    @Trace(operationName = "B1-2查询当前用户权限列表（角色+部门个人）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryCurrentStaffRolePowerListRespDto queryCurrentStaffRolePowerList(BffQueryCurrentStaffRolePowerListReqDto reqDto) {


        QueryCurrentUserPowerListComRespDto queryCurrentUserPowerListComRespDto_1 = null;
//步骤0: D1查询当前用户权限列表(公共) - queryCurrentUserPowerListCom
        QueryCurrentUserPowerListComRespDto queryCurrentUserPowerListComRespDto = null;
        QueryCurrentUserPowerListComReqDto queryCurrentUserPowerListComReqDto = new QueryCurrentUserPowerListComReqDto();


        /*D1查询当前用户权限列表(公共)[10203]   */

        queryCurrentUserPowerListComRespDto = fwBasePowerClient.queryCurrentUserPowerListCom(queryCurrentUserPowerListComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryCurrentUserPowerListComRespDto_1 = queryCurrentUserPowerListComRespDto;

        BffQueryCurrentStaffRolePowerListRespDto retData = new BffQueryCurrentStaffRolePowerListRespDto();
        if (queryCurrentUserPowerListComRespDto_1 != null) {
            retData.setPowerCodeList(queryCurrentUserPowerListComRespDto_1.getPowerCodeList().stream().map(item -> BeanUtil.toBean(item, BffPowerCodeListDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1993011_1
        }


        return retData;
    }

    /**
     * B1查询当前用户就职记录权限[7272]
     * gen by moon at 6/28/2023, 8:47:32 PM
     */
    @Trace(operationName = "B1查询当前用户就职记录权限")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryCurrentUserRecordTributPowerDetailRespDto queryCurrentUserRecordTributPowerDetail(BffQueryCurrentUserRecordTributPowerDetailReqDto reqDto) {


        QueryCurrentUserRecordTributPowerDetailComRespDto queryCurrentUserRecordTributPowerDetailComRespDto_1 = null;
//步骤0: D1-2查询当前用户就职记录权限(公共) - queryCurrentUserRecordTributPowerDetailCom
        QueryCurrentUserRecordTributPowerDetailComRespDto queryCurrentUserRecordTributPowerDetailComRespDto = null;
        QueryCurrentUserRecordTributPowerDetailComReqDto queryCurrentUserRecordTributPowerDetailComReqDto = new QueryCurrentUserRecordTributPowerDetailComReqDto();
        queryCurrentUserRecordTributPowerDetailComReqDto.setTypeCode("PERSONAL_DEPARTMENT");//sourceId:1071401_1
        queryCurrentUserRecordTributPowerDetailComReqDto.setPrivacyCategory("MAIN_DATA_PRIVACY");//sourceId:1071402_1
        queryCurrentUserRecordTributPowerDetailComReqDto.setBusinessPurposes("ALL");//sourceId:1071403_1
        queryCurrentUserRecordTributPowerDetailComReqDto.setAllocationObjectId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID//sourceId:1071398_1
        if (reqDto != null) {
            queryCurrentUserRecordTributPowerDetailComReqDto.setPrivacyCode(reqDto.getPrivacyCode());//SimpleFieldAssign//sourceId:1071397_1
        }

        /*D1-2查询当前用户就职记录权限(公共)[4546]   */
        Assert.isNull(queryCurrentUserRecordTributPowerDetailComReqDto.getPrivacyCode(), "B1查询当前用户就职记录权限-D1-2查询当前用户就职记录权限(公共)-权限标识不能为空", false);
        Assert.isNull(queryCurrentUserRecordTributPowerDetailComReqDto.getTypeCode(), "B1查询当前用户就职记录权限-D1-2查询当前用户就职记录权限(公共)-分配对象类型编码不能为空", false);
        Assert.isNull(queryCurrentUserRecordTributPowerDetailComReqDto.getAllocationObjectId(), "B1查询当前用户就职记录权限-D1-2查询当前用户就职记录权限(公共)-分配对象ID不能为空", false);
        queryCurrentUserRecordTributPowerDetailComRespDto = fwBasePowerClient.queryCurrentUserRecordTributPowerDetailCom(queryCurrentUserRecordTributPowerDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryCurrentUserRecordTributPowerDetailComRespDto_1 = queryCurrentUserRecordTributPowerDetailComRespDto;

        BffQueryCurrentUserRecordTributPowerDetailRespDto retData = new BffQueryCurrentUserRecordTributPowerDetailRespDto();
        if (queryCurrentUserRecordTributPowerDetailComRespDto_1 != null) {
            retData.setPrivacyDistributionId(queryCurrentUserRecordTributPowerDetailComRespDto_1.getPrivacyDistributionId());//SimpleFieldAssign//sourceId:1071406_1
            retData.setPrivacyCode(queryCurrentUserRecordTributPowerDetailComRespDto_1.getPrivacyCode());//SimpleFieldAssign//sourceId:1071407_1
        }


        return retData;
    }


    //
}
